/*
 *  colorTestScene.h
 *  opencvExample
 *
 *  Created by ycam on 11/03/03.
 *  Copyright 2011 __MyCompanyName__. All rights reserved.
 *
 */
#pragma once
#include "ofMain.h"
#include "basePattern.h"

class colorTestScene : public basePattern{
public:
	void setup(){		
		allocate();
		xGap = 50;	
		unsigned char tmpval;
		int zigzig = 8;
		for (int i = 0; i < h; i++){
			for (int j = 0; j < w; j++){
				int px = (j + i) % w;
				if (px % zigzig < zigzig /2) {
					currentColorPixels[(i*w+ px)*3 + 0] = 0;
					currentColorPixels[(i*w+ px)*3 + 1] = 0;
					currentColorPixels[(i*w+ px)*3 + 2] = 0;												
				}
				else {
					if (j < w / 4.0) {
						currentColorPixels[(i*w+ px)*3 + 0] = maxGray;
						currentColorPixels[(i*w+ px)*3 + 1] = 0;
						currentColorPixels[(i*w+ px)*3 + 2] = 0;							
					}
					else if (j < w / 4.0 * 2.0) {
						currentColorPixels[(i*w+ px)*3 + 0] = 0;
						currentColorPixels[(i*w+ px)*3 + 1] = maxGray;
						currentColorPixels[(i*w+ px)*3 + 2] = 0;							
					}
					else if (j < w / 4.0 * 3.0) {
						currentColorPixels[(i*w+ px)*3 + 0] = 0;
						currentColorPixels[(i*w+ px)*3 + 1] = 0;
						currentColorPixels[(i*w+ px)*3 + 2] = maxGray;							
					}
					else{
						currentColorPixels[(i*w+ px)*3 + 0] = 0;
						currentColorPixels[(i*w+ px)*3 + 1] = 0;
						currentColorPixels[(i*w+ px)*3 + 2] = 0;												
					}
				}
			}
		}
	}
	void update(){
		currentColorImage.setFromPixels(currentColorPixels, w, h);	
		count++;
	}
	void setupWhenPatternChanged(){
		count = 0;
	}
	int count;
	int xGap;
	
};